// 小程序短链接
import { DataTypes, UUIDV4 } from 'sequelize';
import { MySqlModel, getSequelize } from '../db';
import { getToday } from '../utils';

class MiniUrl extends MySqlModel {

}

MiniUrl.init({
  id: {
    type: DataTypes.BIGINT, unique: 'id', allowNull: false, autoIncrement: true, primaryKey: true, comment: '主键'
  },
  hotel_id: {
    type: DataTypes.UUID, allowNull: false, validate: { isUUID: 4 }, comment: '主体'
  },
  confirm_number: { type: DataTypes.STRING(50), allowNull: true, comment: '确认号' },
  url: {
    type: DataTypes.STRING(100), allowNull: false, comment: '短链接'
  },
  created_at: {
    type: DataTypes.DATE, allowNull: false, editable: false, comment: '创建时间'
  },
  updated_at: {
    type: DataTypes.DATE, allowNull: false, editable: false, comment: '更新时间'
  }
}, {
  sequelize: getSequelize(),
  tableName: 'mini_url',
  comment: '小程序短链接',
  initialAutoIncrement: 1,
  indexes: [{ fields: ['hotel_id'], unique: false }]
});

export default MiniUrl;
